######################################################
##                                                  ##
##  !!!! Autogenerated YAML file, do not edit !!!!  ##
##                                                  ##
##  Edit source in /src/github/workflows/ instead!  ##
##                                                  ##
######################################################
defaults:
  run:
    shell: bash
jobs:
  cabal:
    env:
      FLAGS: -f enable-cluster-counting
    strategy:
      matrix:
        ghc-ver:
        - 9.2.1
        cabal-ver:
        - latest
        os:
        - windows-latest
        - macos-latest
        - ubuntu-20.04
      fail-fast: false
    runs-on: ${{ matrix.os }}
    needs: auto-cancel
    steps:
    - with:
        submodules: recursive
      uses: actions/checkout@v2
    - with:
        cabal-version: ${{ matrix.cabal-ver }}
        ghc-version: ${{ matrix.ghc-ver }}
      uses: haskell/actions/setup@v1
      id: setup-haskell
    - run: |
        export GHC_VER=$(ghc --numeric-version)
        export CABAL_VER=$(cabal --numeric-version)
        echo "GHC_VER   = ${GHC_VER}"
        echo "CABAL_VER = ${CABAL_VER}"
        echo "GHC_VER=${GHC_VER}"       >> ${GITHUB_ENV}
        echo "CABAL_VER=${CABAL_VER}"   >> ${GITHUB_ENV}
      name: Environment settings based on the Haskell setup
    - run: |
        cabal update
        cabal configure ${FLAGS} -O0
      name: Configure the build plan
    - if: ${{ runner.os == 'Windows' }}
      shell: pwsh
      run: |
        echo "C:\msys64\mingw64\bin;C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
      name: Setup MSYS path (Windows)
    - if: ${{ runner.os == 'Windows' }}
      run: |
        pacman --noconfirm -Sy msys2-keyring mingw-w64-x86_64-pkg-config mingw-w64-x86_64-icu
      name: Install the ICU library (Windows)
    - if: ${{ runner.os == 'macOS' }}
      run: |
        echo "PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig" >> ${GITHUB_ENV}
      name: Set up pkg-config for the ICU library (macOS)
    - with:
        path: |
          ${{ steps.setup-haskell.outputs.cabal-store }}
        key: ${{ runner.os }}-cabal-01-${{ env.GHC_VER }}-${{ env.CABAL_VER }}-${{
          hashFiles('**/plan.json') }}
      uses: actions/cache@v2
      name: Cache dependencies
      id: cache
    - if: ${{ !steps.cache.outputs.cache-hit }}
      run: |
        cabal build --only-dependencies
      name: Install dependencies
    - run: |
        cabal build
      name: Build Agda
    - run: |
        cabal configure -O0
        cabal build
      name: Build Agda without enable-cluster-counting
  auto-cancel:
    if: |
      !contains(github.event.head_commit.message, '[skip ci]')
      && !contains(github.event.head_commit.message, '[ci skip]')
      && !contains(github.event.head_commit.message, '[github skip]')
      && !contains(github.event.head_commit.message, '[skip github]')
    runs-on: Ubuntu-latest
    steps:
    - with:
        access_token: ${{ github.token }}
      uses: styfle/cancel-workflow-action@0.6.0
name: Build (cabal)
'on':
  pull_request:
    paths:
    - .github/workflows/cabal.yml
    - Agda.cabal
    - Setup.hs
    - src/agda-mode/**
    - src/full/**
    - src/main/**
    - test/**.hs
  push:
    branches:
    - master
    - ci-*
    - release*
    paths:
    - .github/workflows/cabal.yml
    - Agda.cabal
    - Setup.hs
    - src/agda-mode/**
    - src/full/**
    - src/main/**
    - test/**.hs
